Node
A generic DOM node. The properties and methods described below are supported by all elements. All properties, except prefix, are read only.
Properties and Methods:
Adds a node as the last child of this node. Returns the added node. This function can be used, for example, to add new menu items to a menu.
Returns an array of Attr objects, one for each attribute on the element.
Returns an array of the child nodes of this node. For example, you could iterate over the childNodes array of a menupopup element to get each menu item.
Creates a duplicate of this node and returns it. The node is not added into the document. You'll have to do that yourself with either insertBefore or appendChild. If the argument deep is set to true, all of the child nodes (and all nodes below them) are also duplicated.
Returns the first child element, which will be equivalent to the first element in the childNodes array.
This function returns true if this node has any child nodes.
Gets and sets the value of the insertbefore ( newchild , refchild ) attribute.
Not implemented for XUL elements.
Returns the last child element, which will be equivalent to the last element in the childNodes array. You can find out how many child elements there are by retrieving the length of the childNodes array.
Returns the node that is immediately after this node at the same level. For example, given a reference to a toolbar button, this property will return the next toolbar button. (assuming there is nothing in-between them).
The name of the node or element. This will be the tag name. For example, for the button element, the nodeName will be the string 'button'. If the element is not in the default namespace, the value will have the namespace prepended to it, with a colon in-between. For example, in a XUL document, an HTML element might have the nodeName 'html:div'. Constrast this property with localName, which returns the tag name without the namespace.
Because nodes are the subclass of most DOM objects, each is identified by a type. For elements, this value will be 1. You don't usually need to use this property unless you are creating or parsing documents.
The value of the node if it has one.
Not implemented for XUL elements.
The document object that the node is contained within.
The parent node of this node. This property is read-only so to move a node, use insertBefore, removeChild and other related methods.
Returns the node that is immediately before this node at the same level.
Removes a child element of this node. The removed child is returned.
Removes the child of this node referenced by oldChild and replaces it with the node referenced by newChild. This function returns the replaced child oldChild.